﻿@model YHWE.Web.Models.channel
@using YHWE.Web.Models;           

@{
    ViewBag.Title = "Edit";
    Layout = "~/Areas/powerManage/Views/Shared/manage.cshtml";
}

<h2>频道管理</h2>
<script>
    function changeChannelType(event) {
        if (event.options[event.selectedIndex].text == "@ChannelTypeEnum.外部") {

            $("#extUrl").show();
        } else {

            $("#extUrl").hide();
        }

    }
</script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>频道</legend>

        @Html.HiddenFor(model => model.ID)

            <div class="editor-label">
                父频道
            </div>

            <div class="editor-field">

                 @Html.DropDownListFor(model => model.parentID, new SelectList(ViewBag.parents, "ID", "name"), "根频道")
            </div>

        
        <div class="editor-label">
            名称
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.name)
            @Html.ValidationMessageFor(model => model.name)

            @(Html.CheckBox("able", true))可见
        </div>
        <div class="editor-label">
            模板类型
        </div>
        <div class="editor-field">
            @Html.DropDownList("type", new SelectList(Enum.GetNames(typeof(ChannelTypeEnum)),Model.type), new { onchange = "changeChannelType(this)" })
            @Html.TextBoxFor(model => model.extUrl, new { style = "display:none" })
            @Html.ValidationMessageFor(model => model.type)
        </div>    
        <div class="editor-label">
            说明
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.exp)
            @Html.ValidationMessageFor(model => model.exp)
            此项为频道说明性文本，将呈现与页面作为子标题
        </div>

        <div class="editor-label">
            备注(不显示)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.bak)
            @Html.ValidationMessageFor(model => model.bak)
        </div>
    </fieldset>
@*    <fieldset>
        <legend>指定权限</legend>
        @Html.Partial("powerBox", Model.power)
    </fieldset> *@
    
        <p>
            <input type="submit" value="保存" />
        </p>
}

<div>
    @Html.ActionLink("回列表", "Index")
</div>

